*/
$wgLogExceptionBacktrace = true;
+/**
+ * If true, the MediaWiki error handler passes errors/warnings to the default error handler
+ * after logging them. The setting is ignored when the track_errors php.ini flag is true.
+ */
+$wgPropagateErrors = true;
+
/**
* Expose backend server host names through the API and various HTML comments
*/
public static function handleError(
$level, $message, $file = null, $line = null
) {
+ global $wgPropagateErrors;
+
if ( in_array( $level, self::$fatalErrorTypes ) ) {
return call_user_func_array(
'MWExceptionHandler::handleFatalError', func_get_args()
$e = new ErrorException( "PHP $levelName: $message", 0, $level, $file, $line );
self::logError( $e, 'error', $severity );
- // This handler is for logging only. Return false will instruct PHP
- // to continue regular handling.
- return false;
+ // If $wgPropagateErrors is true return false so PHP shows/logs the error normally.
+ // Ignore $wgPropagateErrors if the error should break execution, or track_errors is set
+ // (which means someone is counting on regular PHP error handling behavior).
+ return !( $wgPropagateErrors || $level == E_RECOVERABLE_ERROR || ini_get( 'track_errors' ) );
}
/**